package me.send.data.service.provider;

import java.util.Map;

import me.send.business.base.Pager;

public class UserWalletProvider {
    
    public String list(Map<String, Object> param) {
    	String sql = "select telephone,nickname,user_wallet.* from user_wallet left join `user` on user_wallet.userId=`user`.userid where 1=1 ";
    	if (param != null) {
    		String phone = (String) param.get("phone");
    		Integer status = (Integer) param.get("status");
    		Pager page=(Pager) param.get("page");
    		if (phone!=null&&!phone.equals("")) {
    			sql += " and telephone=" + phone;
    		}
    		if (status!=null&&status >= 0) {
    			sql += " and user_wallet.status=" + status;
    		}
    		sql += " limit " + page.getStart() + "," + page.getRows();
    	}
    	return sql;
    }
    public String count(Map<String, Object> param) {
    	String sql = "select count(1) from user_wallet left join `user` on user_wallet.userId=`user`.userid where 1=1 ";
    	if (param != null) {
    		String phone = (String) param.get("phone");
    		Integer status = (Integer) param.get("status");
    		if (phone!=null&&!phone.equals("")) {
    			sql += " and telephone=" + phone;
    		}
    		if (status!=null&&status >= 0) {
    			sql += " and user_wallet.status=" + status;
    		}
    	}
    	return sql;
    }
   
    
    
}
